﻿@model SimpleTaskManager.WebUI.Models.WorkingHoursModel

<script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@{
    ViewBag.Title = "Hours";
}

<h2>Working Hours</h2>
@if(ViewBag.DisplayEdit)
{
    using (Html.BeginForm("Hours", "User", FormMethod.Post)) {
        @Html.ValidationSummary(true)
        <fieldset id="addWorkingHours">
            <legend>My Hours</legend>

            <div class="editor-label">
                @Html.LabelFor(model => model.Date)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.Date)
                @Html.ValidationMessageFor(model => model.Date)
            </div>

            <div class="editor-label">
                @Html.LabelFor(model => model.Hours)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.Hours)
                @Html.ValidationMessageFor(model => model.Hours)
            </div>
        
            <div class="editor-label">
                @Html.LabelFor(model => model.TaskID)
            </div>
            <div class="editor-field">
                @Html.DropDownListFor(model => model.TaskID, Model.UserTasks)
                @Html.ValidationMessageFor(model => model.TaskID)
            </div>
            @Html.HiddenFor(model => model.UserID)

            <p>
                <input type="submit" value="Add" />
            </p>
        </fieldset>
    }
}

 @{ Html.RenderAction("WorkingHoursList", "User", new { id = (ViewBag.DisplayEdit) ? 0 : Model.UserID});}